/*
* @Description: 
* @version: 
* @Author: XiaoQiYan
* @Date: 2021-08-24 12:56:14
 * @LastEditors: XiaoQiYan
 * @LastEditTime: 2021-08-24 13:03:40
*/
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateDemo {
    public static void main(String[] args) {
        String strDate,strTime;
        Date objDate = new Date();
        System.out.println("今天的日期是: "+objDate);
        long time = objDate.getTime();
        System.out.println("自1970年1月1日起以毫秒为单位的时间（GMT）:" +time);
        strDate = objDate.toString();
        strTime = strDate.substring(11,(strDate.length()-4));
        strTime = "时间: "+strTime.substring(0,8);
        System.out.println(strTime);
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println(formatter.format(objDate));
    }
}
